ALMaSS  1.0
The Animal, Landscape and Man Simulation System
Rabbit_Warren Class Reference

A class to describe the rabbits warren system. More...

#include <Rabbit.h>

Inheritance diagram for Rabbit_Warren:
TAnimal TALMaSSObject

Public Member Functions

 Rabbit_Warren (int p_x, int p_y, Landscape *p_L, Rabbit_Population_Manager *p_NPM, int a_size, int a_soil)
 Rabbit warren constructor. More...
 
virtual ~Rabbit_Warren ()
 Rabbit warren destructor. More...
 
virtual void Step ()
 Warren step code. More...
 
virtual void BeginStep ()
 Warren begin step code. More...
 
int Get_TL_x ()
 Get m_TL_x. More...
 
int Get_TL_y ()
 Get m_TL_x. More...
 
APoint GetPointTL ()
 Get the TL coords as a point. More...
 
int GetActiveBurrows ()
 Gets the number of occupied burrows. More...
 
int GetPopulationSize ()
 Gets the total warren population of rabbits. More...
 
bool GetCarryingCapacityFilled ()
 Checks whether all possible burrows are filled with rabbits. More...
 
double GetCarryingCapacityRatio ()
 Checks whether all possible burrows are filled with rabbits. This is updated daily by Rabbit_Warren::UpdateForageInformation. More...
 
int GetCarryingCapacity ()
 Returns the carrying capacity in burrows. More...
 
double GetDiseaseConstant (void)
 Returns the warrens current disease constant. More...
 
void RabbitProductionRecord (RabbitObjectTypes YoungType, int kits)
 Stores data about production of rabbits throughout year. More...
 
int GetRabbitProductionRecord (RabbitObjectTypes YoungType)
 Get data about production of rabbits throughout year. More...
 
void ResetRabbitProductionRecord (RabbitObjectTypes YoungType)
 Reset specific data about production of rabbits throughout year. More...
 
void ResetAllRabbitProductionRecord (void)
 Reset data about production of rabbits throughout year. More...
 
void AddNetworkConnection (LocalWarrenNewtorkEntry a_LWNE)
 Adds a warren to the local network list. More...
 
Rabbit_WarrenGetNetworkWarren (void)
 Chooses a warren to evaluate based on distance. More...
 
void NetworkEvaluation (void)
 Calculates and saves distance probabilities. More...
 
bool IsMember (Rabbit_Base *a_rabbit)
 Returns true if this rabbit belongs to the warren. More...
 
bool IsFreeFemale (void)
 Returns true if there is a female with a burrow and no mate. More...
 
bool IsFreeMale (void)
 Returns true if there is a male with a burrow and no mate. More...
 
void UpdateDominance (void)
 Checks for a dominant female and promotes one if necessary and possible. More...
 
void ChooseNewDominant (void)
 Finds a subdominantfemale and promotes them to dominant. More...
 
int IsFreeBurrow (void)
 Is there a vacent burrow? More...
 
void Leave (Rabbit_Base *a_rabbit)
 Remove this adult from the warren list. More...
 
void Join (Rabbit_Base *a_rabbit)
 Adds this rabbit to the warren list. More...
 
void OccupyWarren (Rabbit_Adult *a_rabbit)
 Adds the first rabbit to the warren list. More...
 
void JoinNOccupy (Rabbit_Adult *a_rabbit)
 Adds this adult to the warren list and house them in a suitable burrow. More...
 
void JoinNMate (Rabbit_Adult *a_mate, RabbitObjectTypes rob_type)
 Adds this rabbit to the warren list and mate him with un-mated female/male with a burrow. More...
 
void Mate (Rabbit_Adult *a_mate, RabbitObjectTypes rob_type)
 Mate him with un-mated female/male with a burrow. More...
 
void OccupyNewBurrow ()
 a_rabbit occupies a newly dug burrow More...
 
void OccupyBurrow ()
 a_rabbit occupies a free burrow More...
 
int GetAllBreedingFemaleRabbits ()
 Supplies the number of breeding rabbits currently in the warren. More...
 
int GetAllBigFemaleRabbits ()
 Supplies the number of big rabbits currently in the warren. More...
 
double GetForagePesticide (void)
 Gets the current mean pesticide concentration per unit forage. More...
 
int GetSoilType (void)
 Gets the warren soil type. More...
 
bool DEBUG_InternalTest ()
 
bool DEBUG_InternalTest2 ()
 
double Disease ()
 Supply the current disease mortality constant. More...
 
void CalcDisease ()
 Calculate the current disease mortality constant. More...
 
double GetAvailableForage (void)
 Returns the available forage realtive to rabbit numbers. More...
 
double GetInvAvailableForage (void)
 Returns the inverse of available forage realtive to rabbit numbers. More...
 
double GetLitterReabsortionConst (void)
 Returns litter reabsorption chance. More...
 
int GetThisYearsBreeders ()
 Returns the number of females breeding this year. More...
 
double GetThisYearsBreedersAv ()
 Returns the number of females breeding this year. More...
 
int GetThisYears1yrOldFemales ()
 Returns the number of 1yr old females. More...
 
int GetLittersThisYear ()
 Returns the number litters produced in the last 12 months. More...
 
int GetThisYearsNonBreeders ()
 Returns the number of females not breeding this year but older than 1 year. More...
 
void UpdateThisYearsBreeders ()
 Calculates and stores the number of breeders and non-breeders. More...
 
double GetDailyMortalityChanceA ()
 Returns the adult daily mortality multiplier. More...
 
double GetDailyMortalityChanceJ ()
 Returns the juvenile daily mortality multiplier. More...
 
double GetCCRabbitsR ()
 Records the number of big female rabbits for carrying capacity calculations. More...
 
- Public Member Functions inherited from TAnimal
unsigned SupplyFarmOwnerRef ()
 
AnimalPosition SupplyPosition ()
 
APoint SupplyPoint ()
 
int SupplyPolygonRef ()
 
int Supply_m_Location_x ()
 
int Supply_m_Location_y ()
 
virtual void KillThis ()
 
virtual void CopyMyself ()
 
void SetX (int a_x)
 
void SetY (int a_y)
 
 TAnimal (int x, int y, Landscape *L)
 
virtual void EndStep (void)
 EndStep behaviour - must be implemented in descendent classes. More...
 
virtual void ReinitialiseObject (int x, int y, Landscape *L)
 Used to re-use an object - must be implemented in descendent classes. More...
 
virtual int WhatState ()
 
virtual void Dying ()
 
void CheckManagement (void)
 
void CheckManagementXY (int x, int y)
 
virtual bool OnFarmEvent (FarmToDo)
 
- Public Member Functions inherited from TALMaSSObject
int GetCurrentStateNo ()
 Returns the current state number. More...
 
void SetCurrentStateNo (int a_num)
 Sets the current state number. More...
 
bool GetStepDone ()
 Returns the step done indicator flag. More...
 
void SetStepDone (bool a_bool)
 Sets the step done indicator flag. More...
 
virtual void ReinitialiseObject ()
 Used to re-use an object - must be implemented in descendent classes. More...
 
 TALMaSSObject ()
 The constructor for TALMaSSObject. More...
 
virtual ~TALMaSSObject ()
 The destructor for TALMaSSObject. More...
 
void OnArrayBoundsError ()
 Used for debugging only, tests basic object properties. More...
 

Public Attributes

int m_breedingfemales
 The number of females that bred this year. More...
 
int m_1yrOldFemales
 The number of 1 year old females. More...
 
int m_littersthisyear
 The number of litters produced this year. More...
 
int m_nonbreedingfemales
 The number of females that did not breed this year but are older than 1 year. More...
 

Static Public Attributes

static double m_maxForageHeight = cfg_maxForageHeight.value()
 The maximum vegetation height assumed for forage potential. More...
 
static double m_minForageDigestability = cfg_minForageDigestability.value()
 The minimum vegetation digestability allowed for foraging. More...
 

Protected Member Functions

void st_WarrenBeing (void)
 The only warren behaviour - it just is. More...
 
void InitEvaluation (void)
 Intiates the evaluation of the warren area. More...
 
int GetForageArea (void)
 Returns the total area of permanent forage. More...
 
int CalcForageArea (void)
 Returns the total area of forage. More...
 
int CalcPermForageArea (void)
 Returns the total area of permanent forage. More...
 
int GetTemporaryForageArea (void)
 Returns the total area of temporary forage. More...
 
int GetCoverArea (void)
 Returns the total area of cover. More...
 
int GetTempForageAreaVeg (void)
 Returns the total area of temporary forage based on veg height
More...
 
int GetCoverAreaVeg (void)
 Returns the total area of cover based on veg height. More...
 
void UpdateForageInformation (void)
 Updates the forage information depending upon the vegetation state. More...
 
void UpdatePesticide (void)
 Updates the pesticide concentration in forage polygons. More...
 
void CalcCarryingCapacityRatio1 ()
 calculates the ratio of rabbits to the carrying capacity More...
 
double CalcCarryingCapacityRatio2 ()
 calculates the ratio of rabbits to the carrying capacity for the local area More...
 
- Protected Member Functions inherited from TAnimal
void CorrectWrapRound ()
 Corrects wrap around co-ordinate problems. More...
 

Protected Attributes

int m_size
 Warren core size in m. More...
 
int m_foragesize
 Warren forage size in m. More...
 
int m_TL_x
 Stores original m_Location_x. More...
 
int m_TL_y
 Stores original m_Location_y. More...
 
int m_maintenence
 Warren maintenence score - if not max then houseing capacity is reduced. More...
 
int m_CarryingCapacity
 Records the max number of rabbit pairs possible here. More...
 
double m_CarryingCapacityR
 Records the max number of rabbits possible here. More...
 
double m_CarryingCapacityR2
 Records the max number of rabbits possible here divided by 2. More...
 
double m_BigFemaleRabbitsR
 Records the number of big female rabbits divided by m_CarryingCapacityR2. More...
 
double m_CarryingCapacityRatio
 Records the ratio between carrying capacity and no rabbits in warren. More...
 
int m_NoBurrows
 Records the maintenence restricted current carrying capacity (burrow number) More...
 
int m_NoOccupiedBurrows
 Records the burrows that are occupied. More...
 
int m_BurrowsUnderConstruction
 Records the burrows that are being dug. More...
 
int m_soiltype
 Variable holding the soil type, 1 = heavy, 0 = sandy, 3 = unsuitable (never used in warrens)
More...
 
int m_rabbitdiggingtime
 The time taken for burrow construction. More...
 
int m_permforagearea
 Variable holding the total permanent forage area. More...
 
int m_foragearea
 Variable holding the total potential forage area. More...
 
double m_availableforage
 Records the amount of forage currently available in the warren area as a proportion of what is the potential relative to rabbit numbers possible. More...
 
double m_foragearearatio
 Records the amount of forage currently available in the warren area as a proportion of total forage area. More...
 
double m_inv_availableforage
 The inverse of m_availableforage, prevents multiple re-calculation. More...
 
double m_litterreabosorptionchance
 Chance of litter reaborption based on the m_availableforage. More...
 
double m_forageP
 Records the amount of pesticde as a mean concentration per unit area forage. More...
 
double m_diseaseconstant
 a measure of disease mortality likelihood More...
 
double m_mortalitymultiplierA
 a measure of mortality likelihood - adults More...
 
double m_mortalitymultiplierJ
 a measure of mortality likelihood - juveniles More...
 
int m_ThisYearsProduction [rob_foobar]
 Storage for rabbit production data. More...
 
TTypeOfRabbitState m_CurrentRState
 Variable to record current behavioural state. More...
 
vector< RabbitWarrenLEInfom_LEList
 List of polygons and the area which is part of the warren. More...
 
vector< LocalWarrenNewtorkEntrym_LocalWarrenNetwork
 List of local warrens and their accessibility from this warren. More...
 
vector< Rabbit_Base * > m_InhabitantsList
 List of rabbits that live here - for easy communication purposes. More...
 
Rabbit_Population_Managerm_OurPopulationManager
 This is a time saving pointer to the correct population manager object. More...
 
int m_runningavFemales
 Keeps track of the number of breeding females. More...
 
int m_runningavCount
 Keeps track of the number of breeding days. More...
 
- Protected Attributes inherited from TAnimal
int m_Location_x
 
int m_Location_y
 
Landscapem_OurLandscape
 
- Protected Attributes inherited from TALMaSSObject
int m_CurrentStateNo
 The basic state number for all objects - '-1' indicates death. More...
 
bool m_StepDone
 Indicates whether the iterative step code is done for this timestep. More...
 

Detailed Description

A class to describe the rabbits warren system.

Constructor & Destructor Documentation

◆ Rabbit_Warren()

Rabbit_Warren::Rabbit_Warren ( int  p_x,
int  p_y,
Landscape p_L,
Rabbit_Population_Manager p_NPM,
int  a_size,
int  a_soil 
)

Rabbit warren constructor.

To get the warrens to display properly the centre location is needed. Unfortunately to work with display this needs to be m_Location_x & m_Location_y so we need to store TL_x & TL_y too

Must do an evaluation of the warren area and populate our list of polygons and areas. This is done by InitEvaluation

1455  : TAnimal(p_x,p_y,p_L)
1456 {
1458  m_OurPopulationManager = p_NPM;
1459  m_size = a_size;
1460  m_maintenence = 0;
1461  m_NoOccupiedBurrows = 0;
1463  m_CarryingCapacity = 0;
1464  m_CarryingCapacityRatio = -1; // No effect for the first period until it is properly calculated
1465  m_InhabitantsList.resize(0);
1466  m_soiltype = a_soil;
1468  m_diseaseconstant = 0.0;
1470  m_BigFemaleRabbitsR = 0.0;
1471  m_runningavCount=0;
1472  m_runningavFemales = 0;
1476  m_Location_x = m_Location_x + (m_size / 2);
1477  m_Location_y = m_Location_y + (m_size / 2);
1478  // Now get the forage size.
1479  m_foragesize = m_size * 2;
1480  m_TL_x = m_Location_x - (m_foragesize / 2);
1481  if (m_TL_x < 0) m_TL_x = 0;
1482  m_TL_y = m_Location_x - (m_foragesize / 2);
1483  if (m_TL_y < 0) m_TL_y = 0;
1487  InitEvaluation();
1488 }
CfgInt cfg_rabbitdiggingtime("RABBIT_DIGGINGTIME", CFG_CUSTOM, 10)
Input variable. Minimum burrow construction time in days.
@ toRabbits_InitialState
Definition: Rabbit.h:84
int value(void)
Definition: configurator.h:98
int m_maintenence
Warren maintenence score - if not max then houseing capacity is reduced.
Definition: Rabbit.h:702
int m_soiltype
Variable holding the soil type, 1 = heavy, 0 = sandy, 3 = unsuitable (never used in warrens)
Definition: Rabbit.h:720
int m_foragesize
Warren forage size in m.
Definition: Rabbit.h:696
int m_rabbitdiggingtime
The time taken for burrow construction.
Definition: Rabbit.h:722
double m_CarryingCapacityRatio
Records the ratio between carrying capacity and no rabbits in warren.
Definition: Rabbit.h:712
vector< Rabbit_Base * > m_InhabitantsList
List of rabbits that live here - for easy communication purposes.
Definition: Rabbit.h:752
void ResetAllRabbitProductionRecord(void)
Reset data about production of rabbits throughout year.
Definition: Rabbit.h:588
int m_NoOccupiedBurrows
Records the burrows that are occupied.
Definition: Rabbit.h:716
int m_CarryingCapacity
Records the max number of rabbit pairs possible here.
Definition: Rabbit.h:704
int m_runningavFemales
Keeps track of the number of breeding females.
Definition: Rabbit.h:756
int m_runningavCount
Keeps track of the number of breeding days.
Definition: Rabbit.h:758
double m_diseaseconstant
a measure of disease mortality likelihood
Definition: Rabbit.h:738
int m_TL_y
Stores original m_Location_y.
Definition: Rabbit.h:700
int m_size
Warren core size in m.
Definition: Rabbit.h:694
double m_BigFemaleRabbitsR
Records the number of big female rabbits divided by m_CarryingCapacityR2.
Definition: Rabbit.h:710
int m_BurrowsUnderConstruction
Records the burrows that are being dug.
Definition: Rabbit.h:718
Rabbit_Population_Manager * m_OurPopulationManager
This is a time saving pointer to the correct population manager object.
Definition: Rabbit.h:754
void InitEvaluation(void)
Intiates the evaluation of the warren area.
Definition: Rabbit.cpp:1497
TTypeOfRabbitState m_CurrentRState
Variable to record current behavioural state.
Definition: Rabbit.h:746
int m_TL_x
Stores original m_Location_x.
Definition: Rabbit.h:698
int m_Location_y
Definition: PopulationManager.h:228
TAnimal(int x, int y, Landscape *L)
Definition: PopulationManager.cpp:1367
int m_Location_x
Definition: PopulationManager.h:225

References cfg_rabbitdiggingtime, InitEvaluation(), m_BigFemaleRabbitsR, m_BurrowsUnderConstruction, m_CarryingCapacity, m_CarryingCapacityRatio, m_CurrentRState, m_diseaseconstant, m_foragesize, m_InhabitantsList, TAnimal::m_Location_x, TAnimal::m_Location_y, m_maintenence, m_NoOccupiedBurrows, m_OurPopulationManager, m_rabbitdiggingtime, m_runningavCount, m_runningavFemales, m_size, m_soiltype, m_TL_x, m_TL_y, ResetAllRabbitProductionRecord(), toRabbits_InitialState, and CfgInt::value().

◆ ~Rabbit_Warren()

Rabbit_Warren::~Rabbit_Warren ( void  )
virtual

Rabbit warren destructor.

1492 {
1493  ;
1494 }

Member Function Documentation

◆ AddNetworkConnection()

void Rabbit_Warren::AddNetworkConnection ( LocalWarrenNewtorkEntry  a_LWNE)
inline

Adds a warren to the local network list.

590 { m_LocalWarrenNetwork.push_back( a_LWNE ); }
vector< LocalWarrenNewtorkEntry > m_LocalWarrenNetwork
List of local warrens and their accessibility from this warren.
Definition: Rabbit.h:750

References m_LocalWarrenNetwork.

◆ BeginStep()

virtual void Rabbit_Warren::BeginStep ( void  )
inlinevirtual

Warren begin step code.

Reimplemented from TAnimal.

560  {
562  }
void CalcCarryingCapacityRatio1()
calculates the ratio of rabbits to the carrying capacity
Definition: Rabbit.cpp:1688

References CalcCarryingCapacityRatio1().

◆ CalcCarryingCapacityRatio1()

void Rabbit_Warren::CalcCarryingCapacityRatio1 ( )
protected

calculates the ratio of rabbits to the carrying capacity

1688  {
1689  m_BigFemaleRabbitsR = GetAllBigFemaleRabbits() / (m_CarryingCapacityR2); // m_CarryingCapacityR is (m_CarryingCapacity * cfg_rabbitdendepscaler.value())/2
1690 }
double m_CarryingCapacityR2
Records the max number of rabbits possible here divided by 2.
Definition: Rabbit.h:708
int GetAllBigFemaleRabbits()
Supplies the number of big rabbits currently in the warren.
Definition: Rabbit.cpp:2286

References GetAllBigFemaleRabbits(), m_BigFemaleRabbitsR, and m_CarryingCapacityR2.

Referenced by BeginStep().

◆ CalcCarryingCapacityRatio2()

double Rabbit_Warren::CalcCarryingCapacityRatio2 ( )
protected

calculates the ratio of rabbits to the carrying capacity for the local area

Here the issue can be that the local warren is too small a unit to use for carrying capacity calculations for the POM tests on Bayreuth Therefore we have two options:

  • 1 use the local rabbits for real landscapes
  • 2 a combined area calculation (which takes more time) for enclosure tests

To speed this on each warren creates its own daily stats which can be combined here.

1692  {
1702 #ifdef __EnclosureTest
1703  double CCRatio = m_BigFemaleRabbitsR;
1704  int nsz = (int)m_LocalWarrenNetwork.size();
1705  for (int i = 0; i < nsz; i++) {
1706  CCRatio += m_LocalWarrenNetwork[i].m_aWarren->GetCCRabbitsR();
1707  }
1708  CCRatio /= (nsz + 1);
1709  return CCRatio;
1710 #endif
1711  return m_BigFemaleRabbitsR; // Is the number of big female rabbits / ((m_CarryingCapacity * cfg_rabbitdendepscaler.value())/2)
1712 }

References m_BigFemaleRabbitsR, and m_LocalWarrenNetwork.

Referenced by UpdateForageInformation().

◆ CalcDisease()

void Rabbit_Warren::CalcDisease ( void  )

Calculate the current disease mortality constant.

To simulate disease we need a globally variying probability with local variations depending upon density This is done by evaluating two levels - the first is the total population density. This is given by the the total number of rabbits divided by the total number of warrens.
The local density is the number of rabbits related to the carrying capacity.
This method is only called at a time period specified as an input variable, so disease will not instantly equilibrate.
The big disease chance is based on global density: prob_density = (totalrabbits / no warren) x (totalrabbits / no warren) * cfg_globaldisease_probability.value(); This is then modified by local density: m_diseaseconstant = prob_density * GetCarryingCapacityRatio

1584 {
1597  // Get the numbers we need
1598  unsigned totalrabbits = m_OurPopulationManager->SupplyAllBigRabbits();
1599  unsigned warrens = m_OurPopulationManager->GetLiveArraySize(rob_Warren);
1600  // Some of this should be done by the population managerfor efficiency but it is here to keep it together.
1601  //The big chance based on global density
1602  double prob_density = (totalrabbits / (double)warrens) * (totalrabbits / (double)warrens) * cfg_globaldisease_probability.value();
1603  // Now the local stuff
1604  m_diseaseconstant = prob_density * GetCarryingCapacityRatio();
1605 }
CfgFloat cfg_globaldisease_probability("RABBIT_GLOBALDISEASEPROBCONSTANT", CFG_CUSTOM, 0.05)
Input variable. A constant use to calculate the probability of density related disease.
@ rob_Warren
Definition: Rabbit.h:74
double value(void)
Definition: configurator.h:118
unsigned GetLiveArraySize(int a_listindex)
Gets the number of 'live' objects for a list index in the TheArray.
Definition: PopulationManager.h:433
unsigned SupplyAllBigRabbits()
Returns the total number of rabbits.
Definition: Rabbit_Population_Manager.h:110
double GetCarryingCapacityRatio()
Checks whether all possible burrows are filled with rabbits. This is updated daily by Rabbit_Warren::...
Definition: Rabbit.h:576

References cfg_globaldisease_probability, GetCarryingCapacityRatio(), Population_Manager::GetLiveArraySize(), m_diseaseconstant, m_OurPopulationManager, rob_Warren, Rabbit_Population_Manager::SupplyAllBigRabbits(), and CfgFloat::value().

Referenced by Rabbit_Population_Manager::DoFirst().

◆ CalcForageArea()

int Rabbit_Warren::CalcForageArea ( void  )
protected

Returns the total area of forage.

This returns the forge area calcuated by element type.

1731 {
1735  int area = 0;
1736  for (vector<RabbitWarrenLEInfo>::size_type k = 0; k<m_LEList.size(); k++)
1737  {
1738  area += m_LEList[k].m_foragearea;
1739  }
1740  return area;
1741 }
vector< RabbitWarrenLEInfo > m_LEList
List of polygons and the area which is part of the warren.
Definition: Rabbit.h:748

References m_LEList.

Referenced by InitEvaluation(), and UpdateForageInformation().

◆ CalcPermForageArea()

int Rabbit_Warren::CalcPermForageArea ( void  )
protected

Returns the total area of permanent forage.

This returns the forge area calcuated by element type.

1745 {
1749  int area = 0;
1750  for (vector<RabbitWarrenLEInfo>::size_type k = 0; k<m_LEList.size(); k++)
1751  {
1752  if (m_LEList[k].m_torh == torh_Forage) area += m_LEList[k].m_area;
1753  }
1754  return area;
1755 }
@ torh_Forage
Definition: Rabbit.h:103

References m_LEList, and torh_Forage.

Referenced by InitEvaluation().

◆ ChooseNewDominant()

void Rabbit_Warren::ChooseNewDominant ( void  )

Finds a subdominantfemale and promotes them to dominant.

Loops through the list to find suitable females who could be dominant. If no fully grown females then the largest one is taken.

1952  {
1956  Rabbit_Female* rfemale = NULL;
1957  Rabbit_Female* rfemaleBig = NULL;
1958  int bigWeight = 0;
1959  int sz = (int)m_InhabitantsList.size();
1960  for (int i = 0; i < sz; i++) {
1961  if (m_InhabitantsList[ i ]->GetRabbitType() == rob_Female) {
1962  rfemale = dynamic_cast<Rabbit_Female*>(m_InhabitantsList[ i ]);
1964  if (rfemale->GetweightAge() >= 300) { // 300 represents max growth
1966  return;
1967  }
1968  else if (rfemale->GetweightAge() > bigWeight) {
1969  bigWeight = rfemale->GetweightAge();
1970  rfemaleBig = rfemale;
1971  }
1972  }
1973  }
1974  }
1975  if (rfemaleBig!=NULL) rfemaleBig->SetSocialStatus( rabbit_socialstatus_dominant );
1976 }
@ rabbit_socialstatus_dominant
Definition: Rabbit.h:115
@ rabbit_socialstatus_subdominant
Definition: Rabbit.h:114
@ rob_Female
Definition: Rabbit.h:73
void SetSocialStatus(TTypesOfRabbitSocialStatus a_status)
Sets the dominance status.
Definition: Rabbit.h:391
TTypesOfRabbitSocialStatus GetSocialStatus(void)
Return the dominance status.
Definition: Rabbit.h:387
int GetweightAge(void)
Get age method.
Definition: Rabbit.h:230
The rabbit female class. All special female behaviour is described here.
Definition: Rabbit.h:444

References Rabbit_Adult::GetSocialStatus(), Rabbit_Base::GetweightAge(), m_InhabitantsList, rabbit_socialstatus_dominant, rabbit_socialstatus_subdominant, rob_Female, and Rabbit_Adult::SetSocialStatus().

Referenced by Rabbit_Female::st_Dying(), and UpdateDominance().

◆ DEBUG_InternalTest()

bool Rabbit_Warren::DEBUG_InternalTest ( )
2299 {
2300  int Mburrs = 0;
2301  int Mmates = 0;
2302  int MBM = 0;
2303  int Fburrs = 0;
2304  int Fmates = 0;
2305  int FBM = 0;
2306  int siz = (int) m_InhabitantsList.size();
2307  int Mdigs = 0;
2308  int Fdigs = 0;
2309  for (int i = 0; i<siz; i++)
2310  {
2311  if (m_InhabitantsList[i]->GetCurrentStateNo() != -1)
2312  {
2313  if (m_InhabitantsList[i]->GetRabbitType() == rob_Male)
2314  {
2315  if (m_InhabitantsList[i]->GetHasBurrow()) Mburrs++; // No males with burrow
2316  if (m_InhabitantsList[i]->GetDigging()>-1) Mdigs++; // No males digging
2317  if (dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[i])->GetMate() != NULL) Mmates++; // No males with mates
2318  if ((dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[i])->GetMate() != NULL) && (m_InhabitantsList[i]->GetHasBurrow())) MBM++; // No males with mates and burrows
2319  }
2320  if (m_InhabitantsList[i]->GetRabbitType() == rob_Female)
2321  {
2322  if (m_InhabitantsList[i]->GetHasBurrow()) Fburrs++;
2323  if (m_InhabitantsList[i]->GetDigging() > -1) Fdigs++;
2324  if (dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[i])->GetMate() != NULL) Fmates++;
2325  if ((dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[i])->GetMate() != NULL) && (m_InhabitantsList[i]->GetHasBurrow())) FBM++;
2326  }
2327  }
2328  }
2329  int alonemales = Mburrs-MBM;
2330  int alonefemales = Fburrs-FBM;
2331  if (MBM != FBM)
2332  {
2333  m_OurLandscape->Warn("IsFreeBurrow","Inconsistent mates and burrows MBM != FBM.");
2334  exit(1);
2335  }
2336  if (MBM + alonemales + alonefemales > m_NoBurrows)
2337  {
2338  m_OurLandscape->Warn("IsFreeBurrow","Too many burrows occupied.");
2339  exit(1);
2340  }
2341  if (MBM + alonemales + alonefemales != this->m_NoOccupiedBurrows)
2342  {
2343  m_OurLandscape->Warn("IsFreeBurrow","Too many burrows occupied.");
2344  exit(1);
2345  }
2346  return true;
2347 }
@ rob_Male
Definition: Rabbit.h:72
void Warn(std::string a_msg1, std::string a_msg2)
Definition: landscape.h:1579
The rabbit adult class. All generic adult behaviour is described here.
Definition: Rabbit.h:379
virtual Rabbit_Adult * GetMate(void)
Get mate pointer.
Definition: Rabbit.h:397
int m_NoBurrows
Records the maintenence restricted current carrying capacity (burrow number)
Definition: Rabbit.h:714
int GetCurrentStateNo()
Returns the current state number.
Definition: PopulationManager.h:121
Landscape * m_OurLandscape
Definition: PopulationManager.h:229

References TALMaSSObject::GetCurrentStateNo(), Rabbit_Adult::GetMate(), m_InhabitantsList, m_NoBurrows, m_NoOccupiedBurrows, TAnimal::m_OurLandscape, rob_Female, rob_Male, and Landscape::Warn().

Referenced by IsFreeBurrow(), JoinNMate(), JoinNOccupy(), Mate(), Rabbit_Adult::OnMateFinishedDigging(), and st_WarrenBeing().

◆ DEBUG_InternalTest2()

bool Rabbit_Warren::DEBUG_InternalTest2 ( )
2351 {
2352  int Mburrs = 0;
2353  int Mmates = 0;
2354  int MBM = 0;
2355  int Fburrs = 0;
2356  int Fmates = 0;
2357  int FBM = 0;
2358  int siz = (int) m_InhabitantsList.size();
2359  for (int i=0; i<siz; i++)
2360  {
2361  if ( m_InhabitantsList[i]->GetRabbitType() == rob_Male)
2362  {
2363  if ( m_InhabitantsList[i]->GetHasBurrow()) Mburrs++;
2364  if ( dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[i])->GetMate()!= NULL) Mmates++;
2365  if (( dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[i])->GetMate()!= NULL) && (m_InhabitantsList[i]->GetHasBurrow())) MBM++;
2366  }
2367  if ( m_InhabitantsList[i]->GetRabbitType() == rob_Female)
2368  {
2369  if ( m_InhabitantsList[i]->GetHasBurrow()) Fburrs++;
2370  if ( dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[i])->GetMate()!= NULL) Fmates++;
2371  if (( dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[i])->GetMate()!= NULL) && (m_InhabitantsList[i]->GetHasBurrow())) FBM++;
2372  }
2373  }
2374  int alonemales = Mburrs-MBM;
2375  int alonefemales = Fburrs-FBM;
2376  if (MBM + alonemales + alonefemales >= m_NoBurrows)
2377  {
2378  m_OurLandscape->Warn("IsFreeBurrow","Too many burrows occupied.");
2379  exit(1);
2380  }
2381  return true;
2382 }

References Rabbit_Adult::GetMate(), m_InhabitantsList, m_NoBurrows, TAnimal::m_OurLandscape, rob_Female, rob_Male, and Landscape::Warn().

Referenced by IsFreeBurrow(), and JoinNOccupy().

◆ Disease()

double Rabbit_Warren::Disease ( )
inline

Supply the current disease mortality constant.

638 { return m_diseaseconstant; }

References m_diseaseconstant.

◆ Get_TL_x()

int Rabbit_Warren::Get_TL_x ( )
inline

Get m_TL_x.

564 { return m_TL_x; }

References m_TL_x.

◆ Get_TL_y()

int Rabbit_Warren::Get_TL_y ( )
inline

Get m_TL_x.

566 { return m_TL_y; }

References m_TL_y.

◆ GetActiveBurrows()

int Rabbit_Warren::GetActiveBurrows ( )
inline

Gets the number of occupied burrows.

570 { return m_NoOccupiedBurrows; }

References m_NoOccupiedBurrows.

◆ GetAllBigFemaleRabbits()

int Rabbit_Warren::GetAllBigFemaleRabbits ( void  )

Supplies the number of big rabbits currently in the warren.

2286  {
2287  int biggies = 0;
2288  int sz = (int)m_InhabitantsList.size();
2289  for (int i = 0; i < sz; i++) {
2290  if (m_InhabitantsList[ i ]->GetRabbitType() == rob_Female) {
2291  if (m_InhabitantsList[ i ]->GetAge()>300) biggies++;
2292  }
2293  }
2294  return biggies;
2295 }

References m_InhabitantsList, and rob_Female.

Referenced by CalcCarryingCapacityRatio1().

◆ GetAllBreedingFemaleRabbits()

int Rabbit_Warren::GetAllBreedingFemaleRabbits ( void  )

Supplies the number of breeding rabbits currently in the warren.

2274  {
2275  int breeders = 0;
2276  int sz = (int)m_InhabitantsList.size();
2277  for (int i = 0; i < sz; i++) {
2278  if (m_InhabitantsList[ i ]->GetRabbitType() == rob_Female) {
2279  if (dynamic_cast<Rabbit_Female*>(m_InhabitantsList[ i ])->GetSocialStatus()>rabbit_socialstatus_subordinate) breeders++;
2280  }
2281  }
2282  return breeders;
2283 }
@ rabbit_socialstatus_subordinate
Definition: Rabbit.h:113

References Rabbit_Adult::GetSocialStatus(), m_InhabitantsList, rabbit_socialstatus_subordinate, and rob_Female.

Referenced by st_WarrenBeing().

◆ GetAvailableForage()

double Rabbit_Warren::GetAvailableForage ( void  )
inline

Returns the available forage realtive to rabbit numbers.

642  {
643  return m_availableforage;
644  }
double m_availableforage
Records the amount of forage currently available in the warren area as a proportion of what is the po...
Definition: Rabbit.h:728

References m_availableforage.

Referenced by Rabbit_Female::st_EvaluateTerritory().

◆ GetCarryingCapacity()

int Rabbit_Warren::GetCarryingCapacity ( )
inline

◆ GetCarryingCapacityFilled()

bool Rabbit_Warren::GetCarryingCapacityFilled ( )
inline

Checks whether all possible burrows are filled with rabbits.

References m_CarryingCapacity, and m_NoOccupiedBurrows.

◆ GetCarryingCapacityRatio()

double Rabbit_Warren::GetCarryingCapacityRatio ( )
inline

Checks whether all possible burrows are filled with rabbits. This is updated daily by Rabbit_Warren::UpdateForageInformation.

576 { return m_CarryingCapacityRatio; }

References m_CarryingCapacityRatio.

Referenced by CalcDisease(), and Rabbit_Population_Manager::WarrenOccupancyRecordOutput().

◆ GetCCRabbitsR()

double Rabbit_Warren::GetCCRabbitsR ( )
inline

Records the number of big female rabbits for carrying capacity calculations.

688  {
689  return m_BigFemaleRabbitsR;
690  }

References m_BigFemaleRabbitsR.

◆ GetCoverArea()

int Rabbit_Warren::GetCoverArea ( void  )
protected

Returns the total area of cover.

This returns the cover area calcuated by element type. This is probably mis-leading and the GetCoverAreaVeg() is better representative of the cover leves including high vegetation levels.

1773 {
1777  int area = 0;
1778  for (vector<RabbitWarrenLEInfo>::size_type k=0; k<m_LEList.size(); k++)
1779  {
1780  if (m_LEList[k].m_torh == torh_Cover) area += m_LEList[k].m_area;
1781  }
1782  return area;
1783 }
@ torh_Cover
Definition: Rabbit.h:105

References m_LEList, and torh_Cover.

◆ GetCoverAreaVeg()

int Rabbit_Warren::GetCoverAreaVeg ( void  )
protected

Returns the total area of cover based on veg height.

This returns the cover area calcuated by element type and vegeation height.

1806  {
1810  int area = 0;
1811  for (vector<RabbitWarrenLEInfo>::size_type k = 0; k<m_LEList.size(); k++) {
1812  if (m_LEList[ k ].m_ele->GetVegHeight() >= m_maxForageHeight) {
1813  if (m_LEList[ k ].m_torh != torh_Other) area += m_LEList[ k ].m_area;
1814  }
1815  }
1816  return area;
1817 }
@ torh_Other
Definition: Rabbit.h:106
static double m_maxForageHeight
The maximum vegetation height assumed for forage potential.
Definition: Rabbit.h:541

References m_LEList, m_maxForageHeight, and torh_Other.

◆ GetDailyMortalityChanceA()

double Rabbit_Warren::GetDailyMortalityChanceA ( )
inline

Returns the adult daily mortality multiplier.

680  {
681  return m_mortalitymultiplierA;
682  }
double m_mortalitymultiplierA
a measure of mortality likelihood - adults
Definition: Rabbit.h:740

References m_mortalitymultiplierA.

Referenced by Rabbit_Adult::EndStep().

◆ GetDailyMortalityChanceJ()

double Rabbit_Warren::GetDailyMortalityChanceJ ( )
inline

Returns the juvenile daily mortality multiplier.

684  {
685  return m_mortalitymultiplierJ;
686  }
double m_mortalitymultiplierJ
a measure of mortality likelihood - juveniles
Definition: Rabbit.h:742

References m_mortalitymultiplierJ.

Referenced by Rabbit_Juvenile::EndStep().

◆ GetDiseaseConstant()

double Rabbit_Warren::GetDiseaseConstant ( void  )
inline

Returns the warrens current disease constant.

580 { return m_diseaseconstant; }

References m_diseaseconstant.

Referenced by Rabbit_Population_Manager::WarrenOccupancyRecordOutput().

◆ GetForageArea()

int Rabbit_Warren::GetForageArea ( void  )
inlineprotected

Returns the total area of permanent forage.

766 { return m_permforagearea; }
int m_permforagearea
Variable holding the total permanent forage area.
Definition: Rabbit.h:724

References m_permforagearea.

◆ GetForagePesticide()

double Rabbit_Warren::GetForagePesticide ( void  )
inline

Gets the current mean pesticide concentration per unit forage.

628  {
629  return m_forageP;
630  }
double m_forageP
Records the amount of pesticde as a mean concentration per unit area forage.
Definition: Rabbit.h:736

References m_forageP.

Referenced by Rabbit_Juvenile::st_Forage(), Rabbit_Male::st_Forage(), and Rabbit_Female::st_Forage().

◆ GetInvAvailableForage()

double Rabbit_Warren::GetInvAvailableForage ( void  )
inline

Returns the inverse of available forage realtive to rabbit numbers.

646  {
647  return m_inv_availableforage;
648  }
double m_inv_availableforage
The inverse of m_availableforage, prevents multiple re-calculation.
Definition: Rabbit.h:732

References m_inv_availableforage.

◆ GetLitterReabsortionConst()

double Rabbit_Warren::GetLitterReabsortionConst ( void  )
inline

Returns litter reabsorption chance.

650  {
652  }
double m_litterreabosorptionchance
Chance of litter reaborption based on the m_availableforage.
Definition: Rabbit.h:734

References m_litterreabosorptionchance.

Referenced by Rabbit_Female::st_GiveBirth(), and Rabbit_Population_Manager::WarrenOccupancyRecordOutput().

◆ GetLittersThisYear()

int Rabbit_Warren::GetLittersThisYear ( )
inline

Returns the number litters produced in the last 12 months.

670  {
671  return m_littersthisyear;
672  }
int m_littersthisyear
The number of litters produced this year.
Definition: Rabbit.h:549

References m_littersthisyear.

Referenced by UpdateThisYearsBreeders(), and Rabbit_Population_Manager::WarrenOccupancyRecordOutput().

◆ GetNetworkWarren()

Rabbit_Warren * Rabbit_Warren::GetNetworkWarren ( void  )

Chooses a warren to evaluate based on distance.

This method chooses a warren from the network with a probability of choice based on the distance from home. However, we need to start at a random point in the list and cycle because otherwise we run the risk of only the first few warrens ever being tested.

1914 {
1919  // Pick a warren
1920  int nsz = (int) m_LocalWarrenNetwork.size();
1921  int loopstart = (int) floor(nsz * g_rand_uni());
1922  for (int i=0; i< nsz; i++ )
1923  {
1924  double chance = g_rand_uni();
1925  int index = (i + loopstart);
1926  if (index >= nsz) index-=nsz;
1927  if (chance>m_LocalWarrenNetwork[i].m_visitprob)
1928  {
1929  return m_LocalWarrenNetwork[i].m_aWarren;
1930  }
1931  }
1932  return NULL;
1933 }
boost::variate_generator< base_generator_type &, boost::uniform_real<> > g_rand_uni

References g_rand_uni, and m_LocalWarrenNetwork.

Referenced by Rabbit_Male::st_EvaluateTerritory(), and Rabbit_Female::st_EvaluateTerritory().

◆ GetPointTL()

APoint Rabbit_Warren::GetPointTL ( )
inline

Get the TL coords as a point.

568 { APoint TL; TL.m_x=m_TL_x; TL.m_y=m_TL_y; return TL; }
A simple class defining an x,y coordinate set.
Definition: ALMaSS_Setup.h:53
int m_y
Definition: ALMaSS_Setup.h:56
int m_x
Definition: ALMaSS_Setup.h:55

References m_TL_x, m_TL_y, APoint::m_x, and APoint::m_y.

◆ GetPopulationSize()

int Rabbit_Warren::GetPopulationSize ( )
inline

Gets the total warren population of rabbits.

572 { return (int)m_InhabitantsList.size(); }

References m_InhabitantsList.

Referenced by Rabbit_Male::st_EvaluateTerritory(), and Rabbit_Population_Manager::WarrenOccupancyRecordOutput().

◆ GetRabbitProductionRecord()

int Rabbit_Warren::GetRabbitProductionRecord ( RabbitObjectTypes  YoungType)
inline

Get data about production of rabbits throughout year.

584 { return m_ThisYearsProduction[YoungType]; }
int m_ThisYearsProduction[rob_foobar]
Storage for rabbit production data.
Definition: Rabbit.h:744

References m_ThisYearsProduction.

Referenced by Rabbit_Population_Manager::WarrenOccupancyRecordOutput().

◆ GetSoilType()

int Rabbit_Warren::GetSoilType ( void  )
inline

Gets the warren soil type.

632 { return m_soiltype; }

References m_soiltype.

Referenced by Rabbit_Population_Manager::SaveWarrenLocations().

◆ GetTempForageAreaVeg()

int Rabbit_Warren::GetTempForageAreaVeg ( void  )
protected

Returns the total area of temporary forage based on veg height

This returns the temporary forge area calcuated by element type and vegetation height.

1787 {
1791  int area = 0;
1792  for (vector<RabbitWarrenLEInfo>::size_type k=0; k<m_LEList.size(); k++)
1793  {
1794  if (m_LEList[k].m_torh == torh_TemporaryForage)
1795  {
1796  if (m_LEList[k].m_ele->GetVegHeight() < m_maxForageHeight )
1797  {
1798  area += m_LEList[k].m_area;
1799  }
1800  }
1801  }
1802  return area;
1803 }
@ torh_TemporaryForage
Definition: Rabbit.h:104

References m_LEList, m_maxForageHeight, and torh_TemporaryForage.

◆ GetTemporaryForageArea()

int Rabbit_Warren::GetTemporaryForageArea ( void  )
protected

Returns the total area of temporary forage.

This returns the forge area calcuated by element type. This is probably mis-leading and the GetTemporaryForageAreaVeg() is better representative of the forage levels.

1759 {
1763  int area = 0;
1764  for (vector<RabbitWarrenLEInfo>::size_type k=0; k<m_LEList.size(); k++)
1765  {
1766  if (m_LEList[k].m_torh == torh_TemporaryForage) area += m_LEList[k].m_area;
1767  }
1768  return area;
1769 }

References m_LEList, and torh_TemporaryForage.

◆ GetThisYears1yrOldFemales()

int Rabbit_Warren::GetThisYears1yrOldFemales ( )
inline

Returns the number of 1yr old females.

666  {
667  return m_1yrOldFemales;
668  }
int m_1yrOldFemales
The number of 1 year old females.
Definition: Rabbit.h:547

References m_1yrOldFemales.

Referenced by Rabbit_Population_Manager::WarrenOccupancyRecordOutput().

◆ GetThisYearsBreeders()

int Rabbit_Warren::GetThisYearsBreeders ( )
inline

Returns the number of females breeding this year.

654  {
655  return m_breedingfemales;
656  }
int m_breedingfemales
The number of females that bred this year.
Definition: Rabbit.h:545

References m_breedingfemales.

Referenced by Rabbit_Population_Manager::WarrenOccupancyRecordOutput().

◆ GetThisYearsBreedersAv()

double Rabbit_Warren::GetThisYearsBreedersAv ( )
inline

Returns the number of females breeding this year.

658  {
659  double av = 0;
660  if (m_runningavCount>0) av = m_runningavFemales / static_cast<double>(m_runningavCount);
661  m_runningavFemales = 0;
662  m_runningavCount = 0;
663  return av;
664  }

References m_runningavCount, and m_runningavFemales.

Referenced by Rabbit_Population_Manager::WarrenOccupancyRecordOutput().

◆ GetThisYearsNonBreeders()

int Rabbit_Warren::GetThisYearsNonBreeders ( )
inline

Returns the number of females not breeding this year but older than 1 year.

674  {
675  return m_nonbreedingfemales;
676  }
int m_nonbreedingfemales
The number of females that did not breed this year but are older than 1 year.
Definition: Rabbit.h:551

References m_nonbreedingfemales.

Referenced by Rabbit_Population_Manager::WarrenOccupancyRecordOutput().

◆ InitEvaluation()

void Rabbit_Warren::InitEvaluation ( void  )
protected

Intiates the evaluation of the warren area.

This method is called when the warren in initially formed and is repsponsible for making the calcuations of forage and cover areas and then calculating the carrying capacity of the warren if fully occupied.

First fix any wrap-around problems.

Next loop through the area and find all the polygons and areas.

This is done by getting the polygon references and checking if we had this one already. If not save it with an area of 1 otherwise increment the correct record by 1.

Once all polygons are identified and counted then they are classified.

Next the carrying capacity is calculated. This is based on forage area possible and is the number of pairs possible.

We assume that the carrying capacity of sandy soil warrens is halved, unless there is only room for one burrow anyway.

1498 {
1511  for (int i=m_TL_x; i<m_TL_x + m_foragesize; i++)
1512  {
1513  for (int j=m_TL_y; j<m_TL_y + m_foragesize; j++)
1514  {
1518  int PRef = m_OurLandscape->SupplyPolyRef(i,j);
1519  bool found=false;
1520  for (vector<RabbitWarrenLEInfo>::size_type k=0; k<m_LEList.size(); k++)
1521  {
1522  if (m_LEList[k].m_ref == PRef)
1523  {
1524  m_LEList[k].m_area++;
1525  found = true;
1526  break;
1527  }
1528  }
1529  if (!found)
1530  {
1531  RabbitWarrenLEInfo a_ele;
1532  a_ele.m_ref = PRef;
1533  a_ele.m_area = 1;
1535  a_ele.m_pesticide_conc = 0;
1536  a_ele.m_forage = 0;
1537  a_ele.m_foragearea = 0;
1538  // don't have this one
1539  m_LEList.push_back(a_ele);
1540  }
1541  }
1542  }
1544  for (vector<RabbitWarrenLEInfo>::size_type k=0; k<m_LEList.size(); k++)
1545  {
1546  TTypesOfLandscapeElement tole = m_LEList[k].m_ele->GetElementType();
1547  m_LEList[k].m_torh = m_OurPopulationManager->ClassifyHabitat(tole);
1548  // Do a little bit of forage managing here
1549  if (m_LEList[k].m_torh == torh_Forage) m_LEList[k].m_foragearea = m_LEList[k].m_area;
1550  else if (m_LEList[k].m_torh == torh_TemporaryForage)
1551  {
1552  // We assume only 50 m strip of fields is usable
1553  int fr = 50 * m_size;
1554  if (m_LEList[k].m_area < fr) fr = m_LEList[k].m_area;
1555  m_LEList[k].m_foragearea = fr;
1556  }
1557  else m_LEList[k].m_foragearea = 0;
1558  }
1562  double minpct = 1.0 / 16.0; // Divide by 16 because the minimum is based on 1/16th of the area used for forage
1563  double pct = m_foragearea/ (double) (m_foragesize * m_foragesize);
1564  if (pct<minpct)
1565  {
1566  // We have a problem, no rabbits can be here
1567  m_CarryingCapacity = 0;
1568  return;
1569  }
1570  if (pct > 0.9) pct = 0.9;
1571  // 1 is the lowest density until soil type is taken into account
1572  // We use the diff between min and actual pct cover, and then add pro-rata the extra proportion of 12 pairs
1573  // NB minpct must never be >= 0.9
1574  m_CarryingCapacity = static_cast<int>(cfg_rabbitminwarrensize.value() + (int)((pct - minpct) / (0.9 - minpct) * cfg_rabbitmaxwarrensize.value())); // e.g. 3 + (0.1 / 0.8 *9) = 3+1.5 for minpct 0.2, pct 0.3
1575  if (m_soiltype == 0) m_CarryingCapacity /= 2;
1576  m_NoBurrows = 0;
1578  m_CarryingCapacityR2 = m_CarryingCapacityR / 2.0; // Done here once to prevent it being recalculated possibly a lot of times later.
1579 
1580 }
static CfgFloat cfg_rabbitminwarrensize("RABBIT_MINWARRENSIZE", CFG_CUSTOM, 2)
The minimum size of a warren.
CfgFloat cfg_rabbitdendepscaler("RABBIT_DENSITYDEPSCALER", CFG_CUSTOM, 4.5)
Input variable. Average family size for calculating carrying capacity.
static CfgFloat cfg_rabbitmaxwarrensize("RABBIT_MAXWARRENSIZE", CFG_CUSTOM, 10)
Use to calculate the maximum size of a warren. Add min to get the real maximum warren size.
int SupplySimAreaHeight(void)
Definition: landscape.h:1637
LE * SupplyLEPointer(int a_polyref)
Definition: landscape.h:1099
int SupplySimAreaWidth(void)
Definition: landscape.h:1632
int SupplyPolyRef(int a_x, int a_y)
Definition: landscape.h:1488
TTypesOfRabbitHabitat ClassifyHabitat(TTypesOfLandscapeElement a_tole)
Classify a landscape element type according to the rabbit habitat classification.
Definition: Rabbit_Population_Manager.cpp:457
int CalcForageArea(void)
Returns the total area of forage.
Definition: Rabbit.cpp:1730
int m_foragearea
Variable holding the total potential forage area.
Definition: Rabbit.h:726
int CalcPermForageArea(void)
Returns the total area of permanent forage.
Definition: Rabbit.cpp:1744
double m_CarryingCapacityR
Records the max number of rabbits possible here.
Definition: Rabbit.h:706
The basic information needed for an LE present in a warren area.
Definition: Rabbit.h:120
int m_foragearea
Definition: Rabbit.h:126
int m_ref
Definition: Rabbit.h:123
LE * m_ele
Definition: Rabbit.h:121
double m_forage
Definition: Rabbit.h:125
double m_pesticide_conc
Definition: Rabbit.h:124
int m_area
Definition: Rabbit.h:122
TTypesOfLandscapeElement
Definition: tole_declaration.h:36

References CalcForageArea(), CalcPermForageArea(), cfg_rabbitdendepscaler, cfg_rabbitmaxwarrensize, cfg_rabbitminwarrensize, Rabbit_Population_Manager::ClassifyHabitat(), RabbitWarrenLEInfo::m_area, m_CarryingCapacity, m_CarryingCapacityR, m_CarryingCapacityR2, RabbitWarrenLEInfo::m_ele, RabbitWarrenLEInfo::m_forage, RabbitWarrenLEInfo::m_foragearea, m_foragearea, m_foragesize, m_LEList, m_NoBurrows, TAnimal::m_OurLandscape, m_OurPopulationManager, m_permforagearea, RabbitWarrenLEInfo::m_pesticide_conc, RabbitWarrenLEInfo::m_ref, m_size, m_soiltype, m_TL_x, m_TL_y, Landscape::SupplyLEPointer(), Landscape::SupplyPolyRef(), Landscape::SupplySimAreaHeight(), Landscape::SupplySimAreaWidth(), torh_Forage, torh_TemporaryForage, and CfgFloat::value().

Referenced by Rabbit_Warren().

◆ IsFreeBurrow()

int Rabbit_Warren::IsFreeBurrow ( void  )

Is there a vacent burrow?

Here we need to determine if there are free burrows, but also what to do about an unoccupied location. If the warren is unoccupied then we need to arrange for the rabbit to slowly make burrow.

Returns
0 if all burrows are occupied
1 if there is a free burrow
2 if the warren is unoccupied and needs a burrow dug or if there is room to make a new burrow
2036 {
2045 #ifdef __RABBITDEBUG
2046  this->DEBUG_InternalTest();
2047 #endif
2048 
2050  {
2051 #ifdef __RABBITDEBUG
2052  this->DEBUG_InternalTest2();
2053 #endif
2054  return 1; // There is a free burrow
2055  }
2057  return 0;
2058 }
bool DEBUG_InternalTest()
Definition: Rabbit.cpp:2298
bool DEBUG_InternalTest2()
Definition: Rabbit.cpp:2350

References DEBUG_InternalTest(), DEBUG_InternalTest2(), m_BurrowsUnderConstruction, m_CarryingCapacity, m_NoBurrows, and m_NoOccupiedBurrows.

Referenced by Rabbit_Male::st_EvaluateTerritory(), and Rabbit_Female::st_EvaluateTerritory().

◆ IsFreeFemale()

bool Rabbit_Warren::IsFreeFemale ( void  )

Returns true if there is a female with a burrow and no mate.

Returns
false if none, true if unmated female found Checks the list of residents for a female with a burrow and no mate.
1979  {
1984  int sz = (int)m_InhabitantsList.size();
1985  for (int i = 0; i<sz; i++) {
1986  if (m_InhabitantsList[ i ]->GetRabbitType() == rob_Female) {
1987  if (m_InhabitantsList[ i ]->GetMate() == NULL) {
1988  if ((m_InhabitantsList[ i ]->GetHasBurrow()) || (m_InhabitantsList[ i ]->GetDigging() > -1)) return true;
1989  }
1990  }
1991  }
1992  return false;
1993 }

References m_InhabitantsList, and rob_Female.

Referenced by Rabbit_Male::st_EvaluateTerritory().

◆ IsFreeMale()

bool Rabbit_Warren::IsFreeMale ( void  )

Returns true if there is a male with a burrow and no mate.

Returns
false if none, true if unmated male found Checks the list of residents for a male with a burrow and no mate.
2015 {
2020  int sz = (int) m_InhabitantsList.size();
2021  for (int i=0; i<sz; i++)
2022  {
2023  if ( m_InhabitantsList[i]->GetRabbitType() == rob_Male )
2024  {
2025  if ( m_InhabitantsList[i]->GetMate()==NULL )
2026  {
2027  if ( (m_InhabitantsList[i]->GetHasBurrow() ) || ( m_InhabitantsList[i]->GetDigging() > -1) ) return true;
2028  }
2029  }
2030  }
2031  return false;
2032 }

References m_InhabitantsList, and rob_Male.

Referenced by Rabbit_Female::st_EvaluateTerritory(), and Rabbit_Female::st_UpdateBreedingStatus().

◆ IsMember()

bool Rabbit_Warren::IsMember ( Rabbit_Base a_rabbit)

Returns true if this rabbit belongs to the warren.

Returns
false if none, true if unmated male found Checks the list of residents for a male with a burrow and no mate.
1997 {
2002  int sz = (int) m_InhabitantsList.size();
2003  for (int i=0; i<sz; i++)
2004  {
2005  if (m_InhabitantsList[i] == a_rabbit )
2006  {
2007  return true;
2008  }
2009  }
2010  return false;
2011 }

References m_InhabitantsList.

Referenced by Rabbit_Female::Rabbit_Female(), and Rabbit_Female::st_EvaluateTerritory().

◆ Join()

void Rabbit_Warren::Join ( Rabbit_Base a_rabbit)

Adds this rabbit to the warren list.

Join a warren.

2062 {
2064  m_InhabitantsList.push_back(a_rabbit);
2065  a_rabbit->SetWarren(this);
2066 }
void SetWarren(Rabbit_Warren *a_warren)
Set the warren pointer.
Definition: Rabbit.h:238

References m_InhabitantsList, and Rabbit_Base::SetWarren().

Referenced by JoinNMate(), JoinNOccupy(), OccupyWarren(), Rabbit_Base::Rabbit_Base(), Rabbit_Male::st_EvaluateTerritory(), and Rabbit_Female::st_EvaluateTerritory().

◆ JoinNMate()

void Rabbit_Warren::JoinNMate ( Rabbit_Adult a_mate,
RabbitObjectTypes  rob_type 
)

Adds this rabbit to the warren list and mate him with un-mated female/male with a burrow.

Loops through the list of warren inhabitants and looks for the target type rob_type. If found without a mate then ascertain if they have a burrow. Social status will depend on whether one or both is available.

2225 {
2230 #ifdef __RABBITDEBUG
2231  this->DEBUG_InternalTest();
2232 #endif
2233  int sz = (int) m_InhabitantsList.size();
2234  for (int r=0; r<sz; r++)
2235  {
2236  Rabbit_Adult* p_rabAdult = dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[ r ]);
2237  if ((m_InhabitantsList[r]->GetRabbitType() == rob_type) && (p_rabAdult->GetMate() == NULL) )
2238  {
2239 #ifdef __RABBITDEBUG
2240  this->DEBUG_InternalTest();
2241 #endif
2242  if (p_rabAdult->GetHasBurrow())
2243  {
2244  a_mate->SetDigging(-1);
2245  a_mate->SetMate(dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[r]));
2246  a_mate->SetHasBurrow(true);
2249  p_rabAdult->SetMate( a_mate );
2250  Join(a_mate);
2251  break;
2252  }
2253  else
2254  if (p_rabAdult->GetDigging() > -1)
2255  {
2256  a_mate->SetMate( p_rabAdult );
2259  p_rabAdult->SetMate( a_mate );
2260  int digging = p_rabAdult->GetDigging();
2261  a_mate->SetDigging(digging);
2262  Join(a_mate);
2263  break;
2264  }
2265 
2266  }
2267  }
2268 #ifdef __RABBITDEBUG
2269  this->DEBUG_InternalTest();
2270 #endif
2271 }
void SetMate(Rabbit_Adult *a_mate)
Set/unset mate status.
Definition: Rabbit.cpp:606
bool GetHasBurrow(void)
Get burrow status.
Definition: Rabbit.h:242
void SetDigging(int a_days)
Set number of days to dig.
Definition: Rabbit.h:250
int GetDigging()
Get number of days to dig.
Definition: Rabbit.h:254
void SetHasBurrow(bool a_status)
Set/unset burrow status.
Definition: Rabbit.h:246
void Join(Rabbit_Base *a_rabbit)
Adds this rabbit to the warren list.
Definition: Rabbit.cpp:2061

References DEBUG_InternalTest(), Rabbit_Base::GetDigging(), Rabbit_Base::GetHasBurrow(), Rabbit_Adult::GetMate(), Join(), m_InhabitantsList, rabbit_socialstatus_subdominant, rabbit_socialstatus_subordinate, Rabbit_Base::SetDigging(), Rabbit_Base::SetHasBurrow(), Rabbit_Adult::SetMate(), and Rabbit_Adult::SetSocialStatus().

Referenced by Rabbit_Male::st_EvaluateTerritory(), and Rabbit_Female::st_EvaluateTerritory().

◆ JoinNOccupy()

void Rabbit_Warren::JoinNOccupy ( Rabbit_Adult a_rabbit)

Adds this adult to the warren list and house them in a suitable burrow.

Join a warren and occupy a burrow.

2092 {
2094 #ifdef __RABBITDEBUG
2095  // Do some safety checks here.
2096  if ((m_NoBurrows <= m_NoOccupiedBurrows) && (m_NoBurrows!=0))
2097  {
2098  m_OurLandscape->Warn("Rabbit_Warren::JoinNOccupy","Attempt to occupy a burrow that is occupied or does not exist.");
2099  exit(1);
2100  }
2101 #endif
2102 #ifdef __RABBITDEBUG
2103  this->DEBUG_InternalTest2();
2104 #endif
2105  Join(a_rabbit);
2106  OccupyBurrow( );
2107  a_rabbit->SetDigging(-1);
2109  a_rabbit->SetHasBurrow( true );
2110 
2111 #ifdef __RABBITDEBUG
2112  this->DEBUG_InternalTest();
2113 #endif
2114 }
void OccupyBurrow()
a_rabbit occupies a free burrow
Definition: Rabbit.cpp:2077

References DEBUG_InternalTest(), DEBUG_InternalTest2(), Join(), m_NoBurrows, m_NoOccupiedBurrows, TAnimal::m_OurLandscape, OccupyBurrow(), rabbit_socialstatus_subdominant, Rabbit_Base::SetDigging(), Rabbit_Base::SetHasBurrow(), Rabbit_Adult::SetSocialStatus(), and Landscape::Warn().

Referenced by Rabbit_Male::st_EvaluateTerritory(), and Rabbit_Female::st_EvaluateTerritory().

◆ Leave()

void Rabbit_Warren::Leave ( Rabbit_Base a_rabbit)

Remove this adult from the warren list.

A rabbit is leaving. It may be because they are dead or because they are moving warrens, or just leaving. The rabbit:rabbit interactions are dealt with by the rabbit objects communicating, but burrow occupancy needs to be sorted out here. Both completed and burrows being dug need to be dealt with.

2118 {
2124  int sz = (int) m_InhabitantsList.size();
2125  for (int i=0; i<sz; i++)
2126  {
2127  if (m_InhabitantsList[i]==a_rabbit)
2128  {
2129  // Found the rabbit.
2130 #ifdef __RABBITDEBUG
2131  // Do some safety checks here.
2132  if ( (a_rabbit->GetRabbitType() >= rob_Male ) && (a_rabbit->GetCurrentRState() != toRabbits_Die) )
2133  {
2134  if ((a_rabbit->GetMate()!=NULL) && (a_rabbit->GetCurrentStateNo() != -1))
2135  {
2136  m_OurLandscape->Warn("Rabbit_Warren::Leave","Attempt to leave a warren with a mate.");
2137  exit(1);
2138  }
2139  // Do some safety checks here.
2140  if ((m_InhabitantsList[i]->GetHasBurrow()) && (a_rabbit->GetMate() != NULL) && (a_rabbit->GetCurrentStateNo() != -1))
2141  {
2142  m_OurLandscape->Warn("Rabbit_Warren::Leave","Attempt to leave a warren with a burrow and mate.");
2143  exit(1);
2144  }
2145  }
2146 #endif
2147  if (a_rabbit->GetRabbitType() > rob_Juvenile)
2148  {
2149  if ((a_rabbit->GetHasBurrow()) && (a_rabbit->GetMate() == NULL)) {
2150  // Single burrow occupier leaving
2152  a_rabbit->SetHasBurrow( false );
2153  }
2154  if ((a_rabbit->GetDigging()!=-1) && (a_rabbit->GetMate() == NULL)) {
2155  // Single digger leaving
2157  a_rabbit->SetDigging( -1 );
2158  }
2159  }
2160  a_rabbit->SetWarren(NULL);
2161  // remove the rabbit from the warren list
2162  m_InhabitantsList.erase(m_InhabitantsList.begin() + i);
2163  break;
2164  }
2165  }
2166 }
@ rob_Juvenile
Definition: Rabbit.h:71
@ toRabbits_Die
Definition: Rabbit.h:96
virtual Rabbit_Adult * GetMate(void)
Get mate pointer.
Definition: Rabbit.h:288
TTypeOfRabbitState GetCurrentRState()
Definition: Rabbit.h:210
RabbitObjectTypes GetRabbitType(void)
Get rabbit type.
Definition: Rabbit.h:218

References Rabbit_Base::GetCurrentRState(), TALMaSSObject::GetCurrentStateNo(), Rabbit_Base::GetDigging(), Rabbit_Base::GetHasBurrow(), Rabbit_Base::GetMate(), Rabbit_Base::GetRabbitType(), m_BurrowsUnderConstruction, m_InhabitantsList, m_NoOccupiedBurrows, TAnimal::m_OurLandscape, rob_Juvenile, rob_Male, Rabbit_Base::SetDigging(), Rabbit_Base::SetHasBurrow(), Rabbit_Base::SetWarren(), toRabbits_Die, and Landscape::Warn().

Referenced by Rabbit_Adult::st_Dying(), Rabbit_Male::st_EvaluateTerritory(), Rabbit_Female::st_EvaluateTerritory(), and Rabbit_Base::~Rabbit_Base().

◆ Mate()

void Rabbit_Warren::Mate ( Rabbit_Adult a_mate,
RabbitObjectTypes  rob_type 
)

Mate him with un-mated female/male with a burrow.

Mates two rabbits and also takes care of deciding whether they need to dig a burrow, and sets the social status.

2170 {
2174 #ifdef __RABBITDEBUG
2175  this->DEBUG_InternalTest();
2176 #endif
2177  int sz = (int) m_InhabitantsList.size();
2178  for (int i=0; i<sz; i++)
2179  {
2180  Rabbit_Adult * p_rabAdult = dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[ i ]);
2181  if ((m_InhabitantsList[ i ]->GetRabbitType() == rob_type) && (p_rabAdult->GetMate() == NULL))
2182  {
2183  if (p_rabAdult->GetHasBurrow())
2184  {
2185 #ifdef __RABBITDEBUG
2186  if (p_rabAdult->GetDigging() != -1)
2187  {
2188  int rubbish = 0;
2189  }
2190 #endif
2191  a_mate->SetDigging( -1 );
2192  a_mate->SetMate( p_rabAdult );
2193  p_rabAdult->SetMate( a_mate );
2194  // If the rabbit already has a burrow then we have a free one now
2195  if (a_mate->GetHasBurrow()) {
2197  }
2198  else a_mate->SetHasBurrow( true );
2201  break;
2202  }
2203  else
2204  if (p_rabAdult->GetDigging() > -1)
2205  {
2206  a_mate->SetMate(dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[i]));
2207  p_rabAdult->SetMate( a_mate );
2208  int digging = p_rabAdult->GetDigging() / 2; // We have help so half the time
2209  p_rabAdult->SetDigging( digging );
2210  a_mate->SetDigging(digging);
2213  break;
2214  }
2215  // Else they are not interesting and we ignore them
2216  }
2217  }
2218 #ifdef __RABBITDEBUG
2219  this->DEBUG_InternalTest();
2220 #endif
2221 }

References DEBUG_InternalTest(), Rabbit_Base::GetDigging(), Rabbit_Base::GetHasBurrow(), Rabbit_Adult::GetMate(), m_InhabitantsList, m_NoOccupiedBurrows, rabbit_socialstatus_subdominant, rabbit_socialstatus_subordinate, Rabbit_Base::SetDigging(), Rabbit_Base::SetHasBurrow(), Rabbit_Adult::SetMate(), and Rabbit_Adult::SetSocialStatus().

Referenced by Rabbit_Male::st_EvaluateTerritory(), Rabbit_Female::st_EvaluateTerritory(), and Rabbit_Female::st_UpdateBreedingStatus().

◆ NetworkEvaluation()

void Rabbit_Warren::NetworkEvaluation ( void  )

Calculates and saves distance probabilities.

We need to randomise the list because otherwise the probability will always favour the first ones added - which causes NE movement in general

1716 {
1717  int nsz = (int) m_LocalWarrenNetwork.size();
1721  random_shuffle (m_LocalWarrenNetwork.begin(), m_LocalWarrenNetwork.end() );
1722  for (int i=0; i< nsz; i++ )
1723  {
1724  // Probability calculated as m_size/dist
1725  m_LocalWarrenNetwork[i].m_visitprob = m_foragesize / (double) (m_LocalWarrenNetwork[i].m_dist);
1726  }
1727 }

References m_foragesize, and m_LocalWarrenNetwork.

◆ OccupyBurrow()

void Rabbit_Warren::OccupyBurrow ( )

a_rabbit occupies a free burrow

2078 {
2080 }

References m_NoOccupiedBurrows.

Referenced by JoinNOccupy(), Rabbit_Male::st_EvaluateTerritory(), and Rabbit_Female::st_EvaluateTerritory().

◆ OccupyNewBurrow()

void Rabbit_Warren::OccupyNewBurrow ( )

a_rabbit occupies a newly dug burrow

2070 {
2072  m_NoBurrows++;
2074 }

References m_BurrowsUnderConstruction, m_NoBurrows, and m_NoOccupiedBurrows.

Referenced by Rabbit_Adult::EndStep().

◆ OccupyWarren()

void Rabbit_Warren::OccupyWarren ( Rabbit_Adult a_rabbit)

Adds the first rabbit to the warren list.

2084 {
2086  a_rabbit->SetDigging( m_rabbitdiggingtime ); // Heavy soil has double digging time
2087  Join(a_rabbit);
2088 }

References Join(), m_BurrowsUnderConstruction, m_rabbitdiggingtime, and Rabbit_Base::SetDigging().

Referenced by Rabbit_Male::st_EvaluateTerritory(), and Rabbit_Female::st_EvaluateTerritory().

◆ RabbitProductionRecord()

void Rabbit_Warren::RabbitProductionRecord ( RabbitObjectTypes  YoungType,
int  kits 
)
inline

Stores data about production of rabbits throughout year.

582 { m_ThisYearsProduction[YoungType] += kits; }

References m_ThisYearsProduction.

Referenced by Rabbit_Female::Rabbit_Female(), Rabbit_Juvenile::Rabbit_Juvenile(), Rabbit_Male::Rabbit_Male(), and Rabbit_Female::st_GiveBirth().

◆ ResetAllRabbitProductionRecord()

void Rabbit_Warren::ResetAllRabbitProductionRecord ( void  )
inline

Reset data about production of rabbits throughout year.

588 { for (int r = (int) rob_Young; r < (int) rob_foobar; r++) m_ThisYearsProduction[r] = 0; }
@ rob_Young
Definition: Rabbit.h:70
@ rob_foobar
Definition: Rabbit.h:75

References m_ThisYearsProduction, rob_foobar, and rob_Young.

Referenced by Rabbit_Warren(), and Rabbit_Population_Manager::WarrenOccupancyRecordOutput().

◆ ResetRabbitProductionRecord()

void Rabbit_Warren::ResetRabbitProductionRecord ( RabbitObjectTypes  YoungType)
inline

Reset specific data about production of rabbits throughout year.

586 { m_ThisYearsProduction[YoungType] = 0; }

References m_ThisYearsProduction.

◆ st_WarrenBeing()

void Rabbit_Warren::st_WarrenBeing ( void  )
protected

The only warren behaviour - it just is.

This is the only warren behaviour - the warren just is, and this is where any daily updates to its status are performed.

First daily job it to determine whether warren maintenence should be kept up, increased or decreased. Then use this to determine the current burrow state. Then a check is made for a dominant female. If there is one then OK, otherwise see if one can be made.

Next the food availability is calculated. This is a cominbination of permanent forage and suitable temporary forage.

Finally if there is any chance that there is some pesticide to take into account the UpdatePesticide method is called.

1866 {
1877 #ifdef __RABBITDEBUG
1879 #endif
1880 
1881  if (m_InhabitantsList.size() == 0)
1882  {
1883  m_maintenence -= 2 - m_soiltype; // Double rate of maintenence for light soil
1884  }
1886  if (m_maintenence < 0)
1887  {
1889  if (m_NoBurrows > 0) m_NoBurrows--;
1890  }
1891  // Dominance check
1892  UpdateDominance();
1893  // Food update
1895  // Now calculates the mortality chance for today
1896  double foragemult = 0;
1897  if (!m_OurPopulationManager->GetForageDay()) foragemult = 1 + cfg_forageareamortscaler.value(); // *(1 - m_availableforage); // m_foragearearatio is 0-1 and larger available forage is reduced.
1898  m_mortalitymultiplierA = 1 + m_diseaseconstant + foragemult; // Disease is the only density dependent death for adults
1899  // We need to de-couple mortality of juveniles and density
1900  m_mortalitymultiplierJ = 1 + foragemult;
1901 #ifdef __RABBITDEBUG
1903 #endif
1904  // Keep track of breeding females for POM
1906  m_runningavCount++;
1908  }
1909 }
static CfgFloat cfg_forageareamortscaler("RABBIT_FORAGEAREAMORTSCALER", CFG_CUSTOM, 60.0)
Input variable. A constant used to increase bad weather mortality as a function of the proportion of ...
bool GetForageDay()
Get method for the forage day flag.
Definition: Rabbit_Population_Manager.h:123
bool IsBreedingSeason(void)
Get whether it is breeding season.
Definition: Rabbit_Population_Manager.h:106
void UpdateDominance(void)
Checks for a dominant female and promotes one if necessary and possible.
Definition: Rabbit.cpp:1936
void UpdateForageInformation(void)
Updates the forage information depending upon the vegetation state.
Definition: Rabbit.cpp:1645
int GetAllBreedingFemaleRabbits()
Supplies the number of breeding rabbits currently in the warren.
Definition: Rabbit.cpp:2274

References cfg_forageareamortscaler, DEBUG_InternalTest(), GetAllBreedingFemaleRabbits(), Rabbit_Population_Manager::GetForageDay(), Rabbit_Population_Manager::IsBreedingSeason(), m_diseaseconstant, m_InhabitantsList, m_maintenence, m_mortalitymultiplierA, m_mortalitymultiplierJ, m_NoBurrows, m_OurPopulationManager, m_rabbitdiggingtime, m_runningavCount, m_runningavFemales, m_soiltype, UpdateDominance(), UpdateForageInformation(), and CfgFloat::value().

Referenced by Step().

◆ Step()

void Rabbit_Warren::Step ( void  )
virtual

Warren step code.

Reimplemented from TAnimal.

1847 {
1848  if (m_StepDone || m_CurrentStateNo == -1) return;
1849  switch (m_CurrentRState)
1850  {
1851  case toRabbits_InitialState:
1853  break;
1854  case toRabbits_WarrenBeing: // Being state is never left for warrens - 'they just are'
1855  st_WarrenBeing();
1856  m_StepDone=true;
1857  break;
1858  default:
1859  m_OurLandscape->Warn("Rabbit_Warren::Step()","unknown state - default");
1860  exit(1);
1861  }
1862 }
@ toRabbits_WarrenBeing
Definition: Rabbit.h:97
void st_WarrenBeing(void)
The only warren behaviour - it just is.
Definition: Rabbit.cpp:1865
bool m_StepDone
Indicates whether the iterative step code is done for this timestep.
Definition: PopulationManager.h:118
int m_CurrentStateNo
The basic state number for all objects - '-1' indicates death.
Definition: PopulationManager.h:116

References m_CurrentRState, TALMaSSObject::m_CurrentStateNo, TAnimal::m_OurLandscape, TALMaSSObject::m_StepDone, st_WarrenBeing(), toRabbits_InitialState, toRabbits_WarrenBeing, and Landscape::Warn().

◆ UpdateDominance()

void Rabbit_Warren::UpdateDominance ( void  )

Checks for a dominant female and promotes one if necessary and possible.

Returns
false if none, true if unmated female found Checks the list of residents for a female with a burrow and no mate.
1936  {
1941  int sz = (int)m_InhabitantsList.size();
1942  for (int i = 0; i<sz; i++) {
1943  if (m_InhabitantsList[ i ]->GetRabbitType() == rob_Female) {
1944  if (dynamic_cast<Rabbit_Female*>(m_InhabitantsList[ i ])->GetSocialStatus() == rabbit_socialstatus_subdominant) return;
1945  }
1946  }
1947  // If we get here we have no dominant female, so see if one can be created.
1949 }
void ChooseNewDominant(void)
Finds a subdominantfemale and promotes them to dominant.
Definition: Rabbit.cpp:1952

References ChooseNewDominant(), Rabbit_Adult::GetSocialStatus(), m_InhabitantsList, rabbit_socialstatus_subdominant, and rob_Female.

Referenced by st_WarrenBeing().

◆ UpdateForageInformation()

void Rabbit_Warren::UpdateForageInformation ( void  )
protected

Updates the forage information depending upon the vegetation state.

This method updates the warren forage information based upon the vegetation height and digestability for each forage polygon. Other options which could be exercised here are to use the vegetation type, biomass or density.

Also calculated here is the amount of available forage relative to the current carrying capacity ratio. Low forage availability will increase death rates in adults, but only if the carrying capacity is too low (based on current forage).

1645  {
1653  double availableforage = m_permforagearea;
1654  for (vector<RabbitWarrenLEInfo>::size_type k = 0; k < m_LEList.size(); k++) {
1655  if (m_LEList[ k ].m_torh == torh_TemporaryForage) {
1656  double vegheight = m_OurLandscape->SupplyVegHeight( m_LEList[ k ].m_ref ); // m_ref is the landscape polyref
1657  double vegdigestability = m_OurLandscape->SupplyVegDigestability( m_LEList[ k ].m_ref );
1658  if ((vegheight < m_maxForageHeight) && (vegdigestability > m_minForageDigestability)) {
1659  // 30 cm
1660  m_LEList[ k ].m_forage = m_LEList[ k ].m_foragearea;
1661  availableforage += m_LEList[ k ].m_foragearea;
1662  }
1663  else m_LEList[ k ].m_forage = 0.0;
1664  }
1665  }
1666  // Only do the expensive pesticide update if there is a chance that there is some pesticide to work with
1668 
1671  m_CarryingCapacityRatio = CalcCarryingCapacityRatio2(); // Normally this is the same as m_BigFemaleRabbitsR, which gets bigger as rabbits get close to CC
1672  }
1673  m_foragearearatio = availableforage / m_foragearea;
1677  }
1678  else {
1679  m_availableforage = 1.0;
1680  m_inv_availableforage = 0.0;
1681  }
1684  }
1685 }
static CfgFloat cfg_litterabsorptionconstant("RABBIT_LITTERABSOPRTIONCONST", CFG_CUSTOM, 1.8)
Used to calculate the chance of litter reabsorption depending on forage conditions.
CfgBool l_pest_enable_pesticide_engine
CfgInt cfg_rabbitdensitydependencedelay
bool value(void)
Definition: configurator.h:135
long SupplyGlobalDate(void)
Definition: landscape.h:1621
double SupplyVegHeight(int a_polyref)
Definition: landscape.h:936
int SupplyDayInYear(void)
Definition: landscape.h:1596
double SupplyVegDigestability(int a_polyref)
Definition: landscape.h:919
void UpdatePesticide(void)
Updates the pesticide concentration in forage polygons.
Definition: Rabbit.cpp:1608
double CalcCarryingCapacityRatio2()
calculates the ratio of rabbits to the carrying capacity for the local area
Definition: Rabbit.cpp:1692
double m_foragearearatio
Records the amount of forage currently available in the warren area as a proportion of total forage a...
Definition: Rabbit.h:730
static double m_minForageDigestability
The minimum vegetation digestability allowed for foraging.
Definition: Rabbit.h:543

References CalcCarryingCapacityRatio2(), CalcForageArea(), cfg_litterabsorptionconstant, cfg_rabbitdensitydependencedelay, l_pest_enable_pesticide_engine, m_availableforage, m_CarryingCapacityRatio, m_foragearea, m_foragearearatio, m_inv_availableforage, m_LEList, m_litterreabosorptionchance, m_maxForageHeight, m_minForageDigestability, TAnimal::m_OurLandscape, m_permforagearea, Landscape::SupplyDayInYear(), Landscape::SupplyGlobalDate(), Landscape::SupplyVegDigestability(), Landscape::SupplyVegHeight(), torh_TemporaryForage, UpdatePesticide(), CfgInt::value(), CfgFloat::value(), and CfgBool::value().

Referenced by st_WarrenBeing().

◆ UpdatePesticide()

void Rabbit_Warren::UpdatePesticide ( void  )
protected

Updates the pesticide concentration in forage polygons.

This is a very 'costly' method. It should not be called if there is no pesticide in use.

Runs through the warren forage area and sums the pesticide.If __RABBITMEANPESTICIDECONC is defined then the pesticide values in all polygons are divided by the area of forage in the warren and the concentration determined. Otherwise the maximum concentration is found in forage areas and set as the value for returning in m_forageP

1608  {
1617  m_forageP = 0.0;
1618  if (!m_OurLandscape->SupplyPesticideDecay(ppp_1)) return;
1619  for (int i = m_TL_x; i < m_TL_x + m_foragesize; i++) {
1620  for (int j = m_TL_y; j < m_TL_y + m_foragesize; j++) {
1621  // Unfortunately we need to check for each square whether the rabbit can forage here.
1622  int ele = m_OurLandscape->SupplyPolyRef( i, j );
1623  for (vector<RabbitWarrenLEInfo>::size_type k = 0; k < m_LEList.size(); k++) {
1624  if (m_LEList[ k ].m_ref == ele) {
1625  if (m_LEList[ k ].m_forage > 0.0) {
1626 #ifdef __RABBITMEANPESTICIDECONC
1628 #else
1629  double pe = m_OurLandscape->SupplyPesticide( i, j , ppp_1);
1630  if (m_forageP< pe ) m_forageP = pe;
1631 #endif
1632  }
1633  break;
1634  }
1635  }
1636  }
1637  }
1638  // Now calculate the mean concentration and mean forage concentration if needed
1639 #ifdef __RABBITMEANPESTICIDECONC
1640  m_forageP /= (double)m_availableforage;
1641 #endif
1642 }
double SupplyPesticide(int a_x, int a_y, PlantProtectionProducts a_ppp)
Gets total pesticide for a location.
Definition: Landscape.cpp:586
bool SupplyPesticideDecay(PlantProtectionProducts a_ppp)
Returns true if there is any pesticide in the system at all at this point.
Definition: Landscape.cpp:776
@ ppp_1
Definition: farm.h:422

References m_availableforage, m_forageP, m_foragesize, m_LEList, TAnimal::m_OurLandscape, m_TL_x, m_TL_y, ppp_1, Landscape::SupplyPesticide(), Landscape::SupplyPesticideDecay(), and Landscape::SupplyPolyRef().

Referenced by UpdateForageInformation().

◆ UpdateThisYearsBreeders()

void Rabbit_Warren::UpdateThisYearsBreeders ( )

Calculates and stores the number of breeders and non-breeders.

Loops through the list of inhabitants and checks if each is a female > 1 year, if so whether it produced a litter this year.

Returns
the number of females that produced litters this year
1821  {
1827  m_breedingfemales = 0;
1829  m_1yrOldFemales = 0;
1830  m_littersthisyear = 0;
1831  int sz = static_cast<int>(m_InhabitantsList.size());
1832  for (int r = 0; r < sz; r++) {
1833  if (m_InhabitantsList[ r ]->GetRabbitType() == rob_Female) {
1834  if (m_InhabitantsList[ r ]->GetAge() < 300) {
1835  m_1yrOldFemales++;
1836  }else{
1837  int litters = dynamic_cast<Rabbit_Female*>(m_InhabitantsList[ r ])->GetLittersThisYear();
1838  if (litters > 0) m_breedingfemales++; else m_nonbreedingfemales++;
1839  m_littersthisyear += litters;
1840  }
1841  }
1842  }
1843 }
int GetLittersThisYear()
Returns the number litters produced in the last 12 months.
Definition: Rabbit.h:670

References GetLittersThisYear(), m_1yrOldFemales, m_breedingfemales, m_InhabitantsList, m_littersthisyear, m_nonbreedingfemales, and rob_Female.

Referenced by Rabbit_Population_Manager::WarrenOccupancyRecordOutput().

Member Data Documentation

◆ m_1yrOldFemales

int Rabbit_Warren::m_1yrOldFemales

The number of 1 year old females.

Referenced by GetThisYears1yrOldFemales(), and UpdateThisYearsBreeders().

◆ m_availableforage

double Rabbit_Warren::m_availableforage
protected

Records the amount of forage currently available in the warren area as a proportion of what is the potential relative to rabbit numbers possible.

Referenced by GetAvailableForage(), UpdateForageInformation(), and UpdatePesticide().

◆ m_BigFemaleRabbitsR

double Rabbit_Warren::m_BigFemaleRabbitsR
protected

Records the number of big female rabbits divided by m_CarryingCapacityR2.

Referenced by CalcCarryingCapacityRatio1(), CalcCarryingCapacityRatio2(), GetCCRabbitsR(), and Rabbit_Warren().

◆ m_breedingfemales

int Rabbit_Warren::m_breedingfemales

The number of females that bred this year.

Referenced by GetThisYearsBreeders(), and UpdateThisYearsBreeders().

◆ m_BurrowsUnderConstruction

int Rabbit_Warren::m_BurrowsUnderConstruction
protected

Records the burrows that are being dug.

Referenced by IsFreeBurrow(), Leave(), OccupyNewBurrow(), OccupyWarren(), and Rabbit_Warren().

◆ m_CarryingCapacity

int Rabbit_Warren::m_CarryingCapacity
protected

Records the max number of rabbit pairs possible here.

Referenced by GetCarryingCapacity(), GetCarryingCapacityFilled(), InitEvaluation(), IsFreeBurrow(), and Rabbit_Warren().

◆ m_CarryingCapacityR

double Rabbit_Warren::m_CarryingCapacityR
protected

Records the max number of rabbits possible here.

Referenced by InitEvaluation().

◆ m_CarryingCapacityR2

double Rabbit_Warren::m_CarryingCapacityR2
protected

Records the max number of rabbits possible here divided by 2.

Referenced by CalcCarryingCapacityRatio1(), and InitEvaluation().

◆ m_CarryingCapacityRatio

double Rabbit_Warren::m_CarryingCapacityRatio
protected

Records the ratio between carrying capacity and no rabbits in warren.

Referenced by GetCarryingCapacityRatio(), Rabbit_Warren(), and UpdateForageInformation().

◆ m_CurrentRState

TTypeOfRabbitState Rabbit_Warren::m_CurrentRState
protected

Variable to record current behavioural state.

Referenced by Rabbit_Warren(), and Step().

◆ m_diseaseconstant

double Rabbit_Warren::m_diseaseconstant
protected

a measure of disease mortality likelihood

Referenced by CalcDisease(), Disease(), GetDiseaseConstant(), Rabbit_Warren(), and st_WarrenBeing().

◆ m_foragearea

int Rabbit_Warren::m_foragearea
protected

Variable holding the total potential forage area.

Referenced by InitEvaluation(), and UpdateForageInformation().

◆ m_foragearearatio

double Rabbit_Warren::m_foragearearatio
protected

Records the amount of forage currently available in the warren area as a proportion of total forage area.

Referenced by UpdateForageInformation().

◆ m_forageP

double Rabbit_Warren::m_forageP
protected

Records the amount of pesticde as a mean concentration per unit area forage.

Referenced by GetForagePesticide(), and UpdatePesticide().

◆ m_foragesize

int Rabbit_Warren::m_foragesize
protected

Warren forage size in m.

Referenced by InitEvaluation(), NetworkEvaluation(), Rabbit_Warren(), and UpdatePesticide().

◆ m_InhabitantsList

◆ m_inv_availableforage

double Rabbit_Warren::m_inv_availableforage
protected

The inverse of m_availableforage, prevents multiple re-calculation.

Referenced by GetInvAvailableForage(), and UpdateForageInformation().

◆ m_LEList

vector<RabbitWarrenLEInfo> Rabbit_Warren::m_LEList
protected

◆ m_litterreabosorptionchance

double Rabbit_Warren::m_litterreabosorptionchance
protected

Chance of litter reaborption based on the m_availableforage.

Referenced by GetLitterReabsortionConst(), and UpdateForageInformation().

◆ m_littersthisyear

int Rabbit_Warren::m_littersthisyear

The number of litters produced this year.

Referenced by GetLittersThisYear(), and UpdateThisYearsBreeders().

◆ m_LocalWarrenNetwork

vector<LocalWarrenNewtorkEntry> Rabbit_Warren::m_LocalWarrenNetwork
protected

List of local warrens and their accessibility from this warren.

Referenced by AddNetworkConnection(), CalcCarryingCapacityRatio2(), GetNetworkWarren(), and NetworkEvaluation().

◆ m_maintenence

int Rabbit_Warren::m_maintenence
protected

Warren maintenence score - if not max then houseing capacity is reduced.

Referenced by Rabbit_Warren(), and st_WarrenBeing().

◆ m_maxForageHeight

double Rabbit_Warren::m_maxForageHeight = cfg_maxForageHeight.value()
static

The maximum vegetation height assumed for forage potential.

From http://informedfarmers.com/rabbit-reproduction/
The size of a warren depends on the soil type. Typically, warrens can be around two metres deep, although warrens in sandy soils are more likely to be smaller and have fewer underground interconnections than warrens in hard soils.
This is because it is easier for rabbits to start a new warren in sandy soil but in harder, clay-type soils it is easier to extend an existing warren. On average, one warren will have 3 to 15 entrances, with each active entrance likely to house two adult rabbits.

Warren carrying capacity is assumed to be maximum if the 90% of whole area is under permanent forage. Max CC is 15 pairs. We assume that the number of pais is linearly related to the area above a minimum required for 3 pairs.

The warren is a square area of the landscape which is of a standard size and must contain a certain proportion of permanent forage habitat (input parameter RABBIT_WARRENMINPCTFORAGE ). The warren manages its own list of resident rabbits and is responsible for ensuring that the number of rabbits does not rise above its carrying capacity which is determined by the total forage available. Maximum possible carrying capacity is 15 burrows, minimum for a warren to exist is 3.
Daily actual carrying capacity is determined by the number of burrows possible and the number that are actually present. On creation there is no burrows present and a rabbit must first occupy the warren then dig the burrow before breeding can start. Subsequently the warren will grow as rabbits dig further burrows if the warren is continually occupied. After 2 years it will be assumed to have reached the maximum number of burrows possible.

Referenced by Rabbit_Population_Manager::AssignStaticVariables(), GetCoverAreaVeg(), GetTempForageAreaVeg(), Rabbit_Population_Manager::Rabbit_Population_Manager(), and UpdateForageInformation().

◆ m_minForageDigestability

double Rabbit_Warren::m_minForageDigestability = cfg_minForageDigestability.value()
static

The minimum vegetation digestability allowed for foraging.

Referenced by Rabbit_Population_Manager::AssignStaticVariables(), and UpdateForageInformation().

◆ m_mortalitymultiplierA

double Rabbit_Warren::m_mortalitymultiplierA
protected

a measure of mortality likelihood - adults

Referenced by GetDailyMortalityChanceA(), and st_WarrenBeing().

◆ m_mortalitymultiplierJ

double Rabbit_Warren::m_mortalitymultiplierJ
protected

a measure of mortality likelihood - juveniles

Referenced by GetDailyMortalityChanceJ(), and st_WarrenBeing().

◆ m_NoBurrows

int Rabbit_Warren::m_NoBurrows
protected

Records the maintenence restricted current carrying capacity (burrow number)

Referenced by DEBUG_InternalTest(), DEBUG_InternalTest2(), InitEvaluation(), IsFreeBurrow(), JoinNOccupy(), OccupyNewBurrow(), and st_WarrenBeing().

◆ m_nonbreedingfemales

int Rabbit_Warren::m_nonbreedingfemales

The number of females that did not breed this year but are older than 1 year.

Referenced by GetThisYearsNonBreeders(), and UpdateThisYearsBreeders().

◆ m_NoOccupiedBurrows

int Rabbit_Warren::m_NoOccupiedBurrows
protected

◆ m_OurPopulationManager

Rabbit_Population_Manager* Rabbit_Warren::m_OurPopulationManager
protected

This is a time saving pointer to the correct population manager object.

Referenced by CalcDisease(), InitEvaluation(), Rabbit_Warren(), and st_WarrenBeing().

◆ m_permforagearea

int Rabbit_Warren::m_permforagearea
protected

Variable holding the total permanent forage area.

Referenced by GetForageArea(), InitEvaluation(), and UpdateForageInformation().

◆ m_rabbitdiggingtime

int Rabbit_Warren::m_rabbitdiggingtime
protected

The time taken for burrow construction.

Referenced by OccupyWarren(), Rabbit_Warren(), and st_WarrenBeing().

◆ m_runningavCount

int Rabbit_Warren::m_runningavCount
protected

Keeps track of the number of breeding days.

Referenced by GetThisYearsBreedersAv(), Rabbit_Warren(), and st_WarrenBeing().

◆ m_runningavFemales

int Rabbit_Warren::m_runningavFemales
protected

Keeps track of the number of breeding females.

Referenced by GetThisYearsBreedersAv(), Rabbit_Warren(), and st_WarrenBeing().

◆ m_size

int Rabbit_Warren::m_size
protected

Warren core size in m.

Referenced by InitEvaluation(), and Rabbit_Warren().

◆ m_soiltype

int Rabbit_Warren::m_soiltype
protected

Variable holding the soil type, 1 = heavy, 0 = sandy, 3 = unsuitable (never used in warrens)

Referenced by GetSoilType(), InitEvaluation(), Rabbit_Warren(), and st_WarrenBeing().

◆ m_ThisYearsProduction

int Rabbit_Warren::m_ThisYearsProduction[rob_foobar]
protected

◆ m_TL_x

int Rabbit_Warren::m_TL_x
protected

Stores original m_Location_x.

Referenced by Get_TL_x(), GetPointTL(), InitEvaluation(), Rabbit_Warren(), and UpdatePesticide().

◆ m_TL_y

int Rabbit_Warren::m_TL_y
protected

Stores original m_Location_y.

Referenced by Get_TL_y(), GetPointTL(), InitEvaluation(), Rabbit_Warren(), and UpdatePesticide().


The documentation for this class was generated from the following files: